;--------------------------------------
;
; vdChar.asm
;
; vdChar(row,col,token)
;
; Byte row     row of string write
; Byte col     column of string write
; Byte token   char + 256*attr
;

;--------------------------------------
;
; include defs, prototypes and macros
;

include tab6.inc

;--------------------------------------
;
; begin code segment
;

    .Code

vdChar PROC PASCAL PUBLIC USES ds es di si bx, prow:Byte,
                                               pcol:Byte,
                                               pchar:Byte,
                                               pattr:Byte
F mdl eq 3    
    push   ds
    mov    ax,SEG scrn_seg
    mov    ds,ax
    mov    ax,ds:scrn_seg
    mov    es,ax
    pop    ds
 ELSE
    mov    ax,scrn_seg
    mov    es,ax
 ENDIF

    xor    ax,ax         ; 0 -> ax
    mov    al,prow       ; row -> al
    mov    bl,160        ; 80 chars wide * 2
    mul    bl            ; row * scrn width  -> ax
    mov    cl,pcol       ; column to cl
    xor    ch,ch         ; 0 -> ch
    shl    cx,1          ; col * 2
    add    ax,cx         ; column + (row * scrn width)
    mov    di,ax         ; point di to scrn
    mov    al,pchar      ; char -> al | token to ax
    mov    ah,pattr      ; attr -> ah |
    stosw                ; ax -> screen
    ret
vdChar ENDP

    END
;
;--------------------------------------    
    

